package com.eight.paper.admin.domain.model.enums;

import java.util.HashMap;
import java.util.Map;


public enum ComposeTypeEnum {

    Dynamics("0", "动态组卷"),
    Random("1", "抽题组卷"),
    Artificial("2", "手动组卷");

    String code;
    String name;

    ComposeTypeEnum(String code, String name) {
        this.code = code;
        this.name = name;
    }


    private static final Map<String, ComposeTypeEnum> keyMap = new HashMap<>();

    static {
        for (ComposeTypeEnum item : ComposeTypeEnum.values()) {
            keyMap.put(item.getCode(), item);
        }
    }

    public static ComposeTypeEnum fromCode(String code) {
        return keyMap.get(code);
    }


    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}
